package com.hmall.user.controller.inner;

import com.hmall.user.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * TODO
 *
 * @Author mr.zhao
 * @Date 2025/6/21 0:41
 */
@Api(tags = "用户相关接口")
@RestController
@RequestMapping("/users")
@RequiredArgsConstructor
public class UserControllerInner {

	private final IUserService userService;

	@ApiOperation("扣减余额")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "pw", value = "支付密码"),
			@ApiImplicitParam(name = "amount", value = "支付金额")
	})
	@PutMapping("/money/deduct/inner")
	public void deductMoney(@RequestParam("userId") Long userId,@RequestParam("pw") String pw, @RequestParam("amount") Integer amount){
		userService.deductMoney(userId,pw, amount);
	}
}
